﻿using System;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using YKXiangQi.Enums;
using YKXiangQi.Models;

namespace YKXiangQi.ViewModels
{
    [Serializable]
    public class PlayerViewModel: ViewModelBase
    {
        public Player Player { get; private set; }
        private bool _isChecked;
        public bool IsChecked
        {
            get { return _isChecked; }
            set { _isChecked = value;
                RaisePropertyChanged(() => this.IsChecked);
            }
        }

        public string Name
        {
            get { return Player.Name; }
        }

        public PlayerViewModel(Player player)
        {
            Player = player;
        }

        public ImageSource Image
        {
            get
            {
                if (Player.Type == PlayerType.Human)
                    return new BitmapImage(new Uri("/Images/user.png", UriKind.Relative));

                return new BitmapImage(new Uri("/Images/computer.png", UriKind.Relative));
            }
        }
    }
}
